genNameList;

%collect data

clear recommen_feat
clear recommen_score

for base_id = 1:length(data_base )
    
    temp = [];
    
    for k = feat_id
        if( k==1 ) %
            temp = [ temp data_base{base_id}.recommend_matrix];
        elseif(k>=2 && k<=11 )
            temp = [temp  data_base{base_id}.global_feat{k-1}];
        end
    end
    
    recommen_feat{base_id} = temp;
    
    if score_id==1
        recommen_score{base_id} = data_base{base_id}.Fmatrix;
    elseif score_id==2
        recommen_score{base_id} = 2 * max(data_base{base_id}.ZeroOne-.5,0);
    end
end

model_name = [ './result/' method_name{method_id} '_feat' ];

for k = feat_id
    model_name = [model_name num2str( k ) ];
end

model_name = [model_name '_on_' ...
            score_name{score_id} '.mat'];

        %%
try
    load(model_name)
catch
    my_model = train_method{ method_id }( recommen_feat{1},recommen_score{1});
    save(model_name,'my_model')
end

clear vali
for i = 1:length( data_base )
    vali{i} = validateModel(        recommen_feat{i},...
                                   recommen_score{i}, ...
                                   my_model, ...
                                   predict_method{method_id});
                                    
end


pick_id = visual_id;

figure(1);
imagesc([vali{pick_id}.mean_score_lab_mat vali{pick_id}.mean_score_res_mat ...
            vali{pick_id}.mean_score_lab_mat - vali{pick_id}.mean_score_res_mat])
        
ylabel('Score on Frames','FontSize',13)
xlabel('Actually   +   Estimate   +   Diff','FontSize',13)
        
figure(2);
n = length(vali{pick_id}.mean_score_lab), N = 1:n;
plot(   N , vali{pick_id}.mean_score_lab, 'r' ,...
        N , vali{pick_id}.mean_score_res, 'b',...
        'LineWidth',2)
    
title( ['AVG Score on Top K ( '...
        ' with ' method_name{method_id} ')'],'FontSize',14)
ylabel(['AVG Score (' score_name{score_id}  ...
        ')'],'FontSize',14)
xlabel('Num of K','FontSize',13)
set(gca,'FontSize',13)
    
grid on

%%
vali_name = [ './vali_result/vali_' method_name{method_id} '_feat' ];
for k = feat_id
    vali_name = [vali_name num2str( k ) ];
end
vali_name = [vali_name '_on_' ...
            score_name{score_id} '.mat'];        
get_act_score;

